package kubayaxi.video.client.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import kubayaxi.video.client.service.ICommentService;
import kubayaxi.video.mybatis.customize.model.comment.dto.AddCommentDTO;
import kubayaxi.video.mybatis.customize.model.comment.dto.AllCommentDTO;
import kubayaxi.video.mybatis.customize.model.comment.dto.LikeCommentDTO;
import kubayaxi.video.mybatis.customize.model.comment.dto.QueryReplyDTO;
import kubayaxi.video.mybatis.customize.model.comment.vo.AllCommentVO;
import kubayaxi.video.mybatis.customize.model.comment.vo.QueryReplyVO;
import kubayaxi.video.service.base.common.request.BaseRequest;
import kubayaxi.video.service.base.common.response.ResponseResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/client/comment")
@Api(tags = "客户端【评论】")
public class CommentController {
    @Resource
    private ICommentService commentService;

    @ApiOperation("全部评论")
    @PostMapping("/allComment")
    public ResponseResult<AllCommentVO> allComment(@RequestBody BaseRequest<AllCommentDTO> dto){
        AllCommentVO ans = commentService.allComment(dto);
        return ResponseResult.success(ans);
    }

    @ApiOperation("发布评论")
    @PostMapping("/addComment")
    public ResponseResult addComment(@RequestBody BaseRequest<AddCommentDTO> dto){
        commentService.addComment(dto);
        return ResponseResult.success();
    }

    @ApiOperation("点赞评论")
    @PostMapping("/likeComment")
    public ResponseResult likeComment(@RequestBody BaseRequest<LikeCommentDTO> dto){
        commentService.likeComment(dto);
        return ResponseResult.success();
    }

    @ApiOperation("查看回复")
    @PostMapping("/queryReply")
    public ResponseResult<QueryReplyVO> queryReply(@RequestBody BaseRequest<QueryReplyDTO> dto){
        QueryReplyVO ans = commentService.queryReply(dto);
        return ResponseResult.success(ans);
    }
}
